package BookManagement.service;

import BookManagement.dao.UserDao;
import BookManagement.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService{
    @Autowired
    private UserDao userDao;

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public User findUserByUsername(String userName){
        return userDao.findUserByUsername(userName);
    }

    @Override
    public int deleteUserByUsername(String userName) {
        return userDao.deleteUserByUsername(userName);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public int updateBorrowNum(String username) {
        return userDao.updateBorrowNum(username);
    }

    @Override
    public int updateBorrowNum2(String username) {
        return userDao.updateBorrowNum2(username);
    }

    @Override
    public int usercount() {
        return userDao.usercount();
    }

    @Override
    public List<User> findAllUsers(HashMap<String, Object> map) {
        return userDao.findAllUsers(map);
    }
}
